<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            perspective: 500px;
        }
        img {
            display: block;
            margin: 100px auto;
            transition: all 1s;
        }
        img:hover{
            transform: rotateX(180deg);
        }

        .box{
            position: relative;
            width: 200px;
            height: 200px;
            margin: 100px auto;
            transform-style: preserve-3d;
            transform: rotateY(45deg);
        }
        .box div {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: pink;
        }
        .box div:last-of-type{
            background-color: blue;
            transform: rotateX(60deg);
        }
    </style>
</head>
<body>
    <img src="images/pic.jpg" alt="">

    <div class="box">
        <div></div>
        <div></div>
    </div>
</body>
</html>